#ifndef _SDK_COMMON_H_
#define _SDK_COMMON_H_

#include <unistd.h>
#include "imp_common.h"
#include "imp_osd.h"
#include "imp_framesource.h"
#include "imp_isp.h"
#include "imp_encoder.h"
#include "imp_log.h"
#include "imp_system.h"
#include "imp_audio.h"
#include "imp_ivs_move.h"
#include "SdkMediaInfo.h"

#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */

/******************************************** Sensor Attribute Table *********************************************/
/* 		NAME		I2C_ADDR		RESOLUTION		Default_Boot			        							*/
/* 		jxf23		0x40 			1920*1080		0:25fps_dvp 1:15fps_dvp 2:25fps_mipi						*/
/* 		jxf37		0x40 			1920*1080		0:25fps_dvp 1:25fps_mipi 2:	25fps_mipi						*/
/* 		imx327		0x1a 			1920*1080		0:25fps 1:25fps_2dol										*/
/* 		sc430ai		0x30 			2688*1520		0:20fps_mipi 1:30fps_mipi 2:25fps_mipi						*/
/* 		sc500ai		0x30 			2880*1620		0:30fps_mipi											    */
/* 		sc5235		0x30 			2592*1944		0:5fps_mipi													*/
/* 		gc4663		0x29 			2560*1440		0:25fps_mipi 1:30fps_mipi						            */
/* 		sc8238		0x30 			3840*2160		0:15fps 1:30fps 											*/
/******************************************** Sensor Attribute Table *********************************************/

#define CHIPSDK_SENSOR_NAME_GC2083          "gc2083"
#define CHIPSDK_I2C_ADDR_GC2083             0x37

/* first sensor */
#define FIRST_SNESOR_NAME                   "gc2083"                        //sensor name (match with snesor driver name)
#define FIRST_I2C_ADDR                      0x37                            //sensor i2c address
#define FIRST_I2C_ADAPTER_ID                0                               //sensor controller number used (0/1/2/3)
#define FIRST_RST_GPIO                      GPIO_PA(18)                     //sensor reset gpio
#define FIRST_PWDN_GPIO                     GPIO_PA(19)                     //sensor pwdn gpio
#define FIRST_POWER_GPIO                    -1                              //sensor power gpio
#define FIRST_SENSOR_ID                     0                               //sensor index
#define FIRST_VIDEO_INTERFACE               IMPISP_SENSOR_VI_MIPI_CSI0      //sensor interface type (dvp/csi0/csi1)
#define FIRST_MCLK                          IMPISP_SENSOR_MCLK0             //sensor clk source (mclk0/mclk1/mclk2)
#define FIRST_DEFAULT_BOOT                  0                               //sensor default mode(0/1/2/3/4)

#define CHN0_EN                             1
#define CHN1_EN                             1

#if CMAKE_USE_CHIP_AI
#define CHN2_EN                             1
#else
#define CHN2_EN                             0
#endif

#define FIRST_CROP_EN                       0

#define FIRST_SENSOR_FRAME_RATE_NUM			DEF_SDK_VIDEO_FPS
#define FIRST_SENSOR_FRAME_RATE_DEN			1

#define DEF_PERSONVEHICLEPETDET_FRAME       25

#define FIRST_SENSOR_WIDTH_THIRD			1280
#define FIRST_SENSOR_HEIGHT_THIRD			720

#define DEF_PERSONVEHICLEPETDET_WIDTH       640
#define DEF_PERSONVEHICLEPETDET_HEIGHT      384

#define BITRATE_720P_Kbs                    1000
#define NR_FRAMES_TO_SAVE                   200
#define STREAM_BUFFER_SIZE                  (1 * 1024 * 1024)

#define ENC_VIDEO_CHANNEL                   0
#define ENC_JPEG_CHANNEL                    1

#define OSD_REGION_WIDTH                    16
#define OSD_REGION_HEIGHT                   34
#define OSD_REGION_WIDTH_SEC                8
#define OSD_REGION_HEIGHT_SEC               18

#define DEF_OSD_LOGO_WIDTH                  120
#define DEF_OSD_LOGO_HEIGHT                 24
#define DEF_OSD_LOGO_WIDTH_SEC              80
#define DEF_OSD_LOGO_HEIGHT_SEC             16

#define FS_CHN_NUM                          3

#if CMAKE_USE_CHIP_AI
#define IVS_CHN_ID                          2
#else
#define IVS_CHN_ID                          1
#endif

#define CH0_INDEX                           0
#define CH1_INDEX                           1
#define CH2_INDEX                           2

#define CHN_ENABLE                          1
#define CHN_DISABLE                         0

#define  CHN_NUM  ARRAY_SIZE(chn)

/*#define SUPPORT_RGB555LE*/
struct chn_conf
{
    unsigned int index;//0 for main channel ,1 for second channel
    unsigned int enable;
    IMPEncoderProfile payloadType;
    IMPFSChnAttr fs_chn_attr;
    IMPCell framesource_chn;
    IMPCell imp_encoder;
};

typedef struct sample_osd_param
{
    int *phandles;
    uint32_t *ptimestamps;
}IMP_Sample_OsdParam;

typedef struct bitmapinfo
{
    uint32_t width;
    uint8_t *pdata;
} bitmapinfo_t;

#ifdef __cplusplus
}
#endif /* __cplusplus */

#endif
